package com.heima.user.service.impl;

import com.heima.common.dto.ResponseResult;
import com.heima.media.entity.WmChannel;
import com.heima.user.entity.ApUserChannel;
import com.heima.user.mapper.ApUserChannelMapper;
import com.heima.user.service.IApUserChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * APP用户频道信息表 服务实现类
 * </p>
 *
 * @author lixinyu
 * @since 2022-08-04
 */
@Service
public class ApUserChannelServiceImpl extends ServiceImpl<ApUserChannelMapper, ApUserChannel> implements IApUserChannelService {

    @Override
    public ResponseResult updateChannel(WmChannel wmChannel) {
        ApUserChannel apUserChannel = this.getById(wmChannel.getId());  //根据id值向user数据库中查channel
        ApUserChannel channel = new ApUserChannel();
        BeanUtils.copyProperties(wmChannel,channel);
        System.out.println("user端的业务层获取到的数据："+channel);
//        if(apUserChannel==null){
//            this.save(channel); //向user的channel表中插入数据
//            return ResponseResult.okResult(channel);
//        }
//        this.updateById(channel);  //更新数据
        return ResponseResult.okResult(channel);
    }
}
